package com.qfhd.soft.cjzcore.UI.MulitRecycle.factory;

import android.view.View;

import com.qfhd.soft.cjzcore.R;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.bean.Task_image_Bean;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.bean.Task_image_detail_section_bean;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.bean.Task_image_submit_bean;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.bean.Task_try_Bean;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.viewholder.BaseViewHolder;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.viewholder.Task_image_ViewHolder;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.viewholder.Task_image_detial_section_viewHolder;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.viewholder.Task_image_submit_viewHolder;
import com.qfhd.soft.cjzcore.UI.MulitRecycle.viewholder.Task_try_ViewHolder;

/**
 * Created by beifeng on 2017/2/17.
 * 实现type工程类
 */

public class ItemTypeFactory implements TypeFactory {
    //  将id作为type传入adapter
    private static final int Task_try_layout = R.layout.task_try_layout;
    private static final int Task_image_layout = R.layout.image_task_item_layout;
    private static final int Task_image_detail_step_layout = R.layout.task_image_detail_step_layout;
    private static final int Task_image_submit_layout = R.layout.task_image_detail_submit_layout;

    @Override
    public int type(Task_try_Bean task_try_bean) {
        return Task_try_layout;
    }

    @Override
    public int type(Task_image_Bean task_image_bean) {
        return Task_image_layout;
    }

    @Override
    public int type(Task_image_detail_section_bean task_image_detail_section_bean) {
        return Task_image_detail_step_layout;
    }

    @Override
    public int type(Task_image_submit_bean task_image_submit_bean) {
        return Task_image_submit_layout;
    }

    @Override
    public BaseViewHolder createViewHolder(int type, View itemView) {
        if(type == Task_try_layout){
            return new Task_try_ViewHolder(itemView);
        }
        else if(type == Task_image_layout){
            return new Task_image_ViewHolder(itemView);
        }
        else if(type == Task_image_detail_step_layout){
            return new Task_image_detial_section_viewHolder(itemView);
        }
        else if(type == Task_image_submit_layout){
            return new Task_image_submit_viewHolder(itemView);
        }
        else{
            return null;
        }
    }
}
